package day06;

import java.sql.SQLOutput;
import java.util.Arrays;

public class Exercise_day06 {
    public static void main(String[] args) {
        say();
        sayHi("刘顺国");
        sayHello("刘顺国",33);
        double a = getNum();
        System.out.println(a);
        int b=plus(5,6);
        System.out.println(b);
        int[]c=testArray(5,50);
        System.out.println("数组的长度是:"+c.length);
        for (int i=0;i<c.length;i++){
            System.out.println(c[i]);
        }
        int[]d=testArray(10,100);
        System.out.println(d[0]);
        for (int i=0;i<d.length;i++){
            System.out.println(d[i]);
        }
        int[]g=new int[10];
        for (int i=0;i<g.length;i++){
            g[i]=(int)(Math.random()*100);
            System.out.println(g[i]);
        }
        int max=g[0];
        for (int i=0;i<g.length;i++){
            if (g[i]>max){
                max=g[i];
            }
        }
        System.out.println("最大值是:"+max);
        g= Arrays.copyOf(g,g.length+1);
        g[g.length-1]=max;
        for (int i=0;i<g.length;i++){
            System.out.println(g[i]);
        }





        /*
        say();
        sayHi("刘顺国");
        sayHello("刘顺国",33);
        double a = getNum();
        System.out.println(a);
        int b=plus(5,6);
        System.out.println(b);
        int[]c=testArray(5,50);
        System.out.println("数组的长度是:"+c.length);
        for (int i=0;i<c.length;i++){
            System.out.println(c[i]);
        }
        int[]d=testArray(10,100);
        System.out.println(d[0]);
        for (int i=0;i<d.length;i++){
            System.out.println(d[i]);
        }
        int[]g=new int[10];
        for (int i=0;i<g.length;i++){
            g[i]=(int)(Math.random()*100);
            System.out.println(g[i]);
        }
        int max=g[0];
        for (int i=0;i<g.length;i++){
            if (g[i]>max){
                max=g[i];
            }
        }
        System.out.println("最大值是:"+max);
        g= Arrays.copyOf(g,g.length+1);
        g[g.length-1]=max;
        for (int i=0;i<g.length;i++){
            System.out.println(g[i]);
        }

         */


    }
    public static void say(){
        System.out.println("好好学习,天天向上!");
    }
    public static void sayHi(String name){
        System.out.println("大家好，我叫"+name+",今年33岁了!");
    }
    public static void sayHello(String name,int age){
        System.out.println("大家好，我叫"+name+",今年"+age+"岁了!");
    }
    public static double getNum(){
        //return "abc"
        return 8.88;
    }
    public static int plus(int num1,int num2){
        int num=num1+num2;
        return num;
    }
    public static int[]testArray(int len,int max){
        int[]arr=new int[len];
        for (int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*(max+1));
        }
        return arr;
    }
    /*
    public static void say(){
        System.out.println("好好学习,天天向上!");
    }
    public static void sayHi(String name){
        System.out.println("大家好，我叫"+name+",今年33岁了!");
    }
    public static void sayHello(String name,int age){
        System.out.println("大家好，我叫"+name+",今年"+age+"岁了!");
    }
    public static double getNum(){
        //return "abc"
        return 8.88;
    }
    public static int plus(int num1,int num2){
        int num=num1+num2;
        return num;
    }
    public static int[]testArray(int len,int max){
        int[]arr=new int[len];
        for (int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*(max+1));
        }
        return arr;
    }
    
     */
}
